home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
dialog
/
dialog.frm
< prev
next >
Wrap
Text File
|
1994-10-18
|
8KB
|
292 lines
VERSION 2.00
Begin Form frmMyDialog
BorderStyle = 3 'Fixed Double
ClientHeight = 3090
ClientLeft = 1785
ClientTop = 2205
ClientWidth = 6480
ControlBox = 0 'False
Height = 3495
Left = 1725
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3090
ScaleWidth = 6480
Top = 1860
Width = 6600
Begin CommandButton CommandButton
Caption = "Command1"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 465
Index = 0
Left = 225
TabIndex = 0
Top = 2475
Visible = 0 'False
Width = 1185
End
Begin Label pnlCaption
Alignment = 2 'Center
BackColor = &H00800000&
Caption = "Label1"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00FFFFFF&
Height = 270
Left = 15
TabIndex = 2
Top = 15
Width = 6450
End
Begin Image imgIcon
Height = 480
Index = 3
Left = 45
Picture = DIALOG.FRX:0000
Top = 1665
Visible = 0 'False
Width = 480
End
Begin Image imgIcon
Height = 480
Index = 2
Left = 45
Picture = DIALOG.FRX:083A
Top = 1125
Visible = 0 'False
Width = 480
End
Begin Image imgIcon
Height = 480
Index = 1
Left = 45
Picture = DIALOG.FRX:1074
Top = 585
Visible = 0 'False
Width = 480
End
Begin Image imgIcon
Height = 450
Index = 0
Left = 45
Picture = DIALOG.FRX:18AE
Top = 90
Visible = 0 'False
Width = 465
End
Begin Label lblMessage
AutoSize = -1 'True
Caption = "12"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Left = 720
TabIndex = 1
Top = 450
Width = 5685
WordWrap = -1 'True
End
End
Option Explicit
Dim fgParms(1 To 3) As String
Dim fgintPCount As Integer
Sub CommandButton_Click (Index As Integer)
Select Case Val(fgParms(2)) Mod 8
Case 0
akRetVal = 1
Case 1
Select Case Index
Case 0
akRetVal = 1
Case 1
akRetVal = 2
End Select
Case 2
Select Case Index
Case 0
akRetVal = 3
Case 1
akRetVal = 4
Case 2
akRetVal = 5
End Select
Case 3
Select Case Index
Case 0
akRetVal = 6
Case 1
akRetVal = 7
Case 2
akRetVal = 2
End Select
Case 4
Select Case Index
Case 0
akRetVal = 6
Case 1
akRetVal = 7
End Select
Case 5
Select Case Index
Case 0
akRetVal = 4
Case 1
akRetVal = 2
End Select
End Select
Unload Me
End Sub
Sub Form_Activate ()
Dim lNumberOfButtons As Integer
Dim lFormWidth As Integer
Dim lButtonMid As Integer
Dim lCButton As Integer
Dim lParameters As String
Dim lintWhereComma As Integer
Dim I%
Dim lRectForm As RECT
Dim lTX As Integer
Dim lTY As Integer
Dim lImageNumber As Integer
Dim lDefButton As Integer
lTX = Screen.TwipsPerPixelX
lTY = Screen.TwipsPerPixelY
lParameters = Me.Tag
fgintPCount = 1
lintWhereComma = InStr(lParameters, ",")
Do While lintWhereComma > 0
fgParms(fgintPCount) = Left$(lParameters, lintWhereComma - 1)
lParameters = Mid$(lParameters, lintWhereComma + 1)
fgintPCount = fgintPCount + 1
lintWhereComma = InStr(lParameters, ",")
Loop
fgParms(fgintPCount) = lParameters
lImageNumber = -1
Select Case Val(fgParms(2)) And (768)
Case 0
lDefButton = 0
Case 256
lDefButton = 1
Case 512
lDefButton = 2
End Select
Select Case Val(fgParms(2)) And (112)
Case 16
lImageNumber = 0
Case 32
lImageNumber = 1
Case 48
lImageNumber = 2
Case 64
lImageNumber = 3
End Select
If lImageNumber >= 0 Then
imgIcon(lImageNumber).Visible = True
imgIcon(lImageNumber).Left = 60
lblMessage.Left = 240 + (32 * lTX)
End If
lblMessage = fgParms(1)
If lImageNumber >= 0 Then
'If lblMessage.Height > (32 * lTX) Then
imgIcon(lImageNumber).Top = lblMessage.Top + (lblMessage.Height / 2) - (imgIcon(lImageNumber).Height / 2)
'Else
' imgIcon(lImageNumber).Top = lblMessage.Top
'End If
End If
Me.Height = lblMessage.Height + CommandButton(0).Height + 270 + 600
CommandButton(0).Top = Me.ScaleHeight - CommandButton(0).Height - 90
lRectForm.Left = Me.Left / lTX
lRectForm.Top = Me.Top / lTY
lRectForm.right = lRectForm.Left + Me.Width / lTX
lRectForm.bottom = lRectForm.Top + Me.Height / lTY
setCursorPos (lRectForm.Left + 10), (lRectForm.Top + 10)
DoEvents
ClipCursorRect lRectForm
If fgintPCount < 3 Then
Me!pnlCaption = app.EXEName
Else
Me!pnlCaption = fgParms(3)
End If
If fgintPCount < 2 Then
fgParms(2) = "0"
End If
Select Case Val(fgParms(2)) Mod 8
Case 0
lNumberOfButtons = 1
CommandButton(0).Caption = "OK"
lDefButton = 0
Case 1
Load CommandButton(1)
CommandButton(0).Caption = "OK"
CommandButton(1).Caption = "Cancel"
If lDefButton > 1 Then
lDefButton = 0
End If
lNumberOfButtons = 2
Case 2
Load CommandButton(1)
Load CommandButton(2)
CommandButton(0).Caption = "Abort"
CommandButton(1).Caption = "Retry"
CommandButton(2).Caption = "Ignore"
lNumberOfButtons = 3
Case 3
Load CommandButton(1)
Load CommandButton(2)
CommandButton(0).Caption = "Yes"
CommandButton(1).Caption = "No"
CommandButton(2).Caption = "Cancel"
lNumberOfButtons = 3
Case 4
Load CommandButton(1)
CommandButton(0).Caption = "Yes"
CommandButton(1).Caption = "No"
lNumberOfButtons = 2
If lDefButton > 1 Then
lDefButton = 0
End If
Case 5
Load CommandButton(1)
CommandButton(0).Caption = "Retry"
CommandButton(1).Caption = "Cancel"
lNumberOfButtons = 2
If lDefButton > 1 Then
lDefButton = 0
End If
End Select
lFormWidth = Me.ScaleWidth
lButtonMid = lFormWidth / (lNumberOfButtons + 1)
For lCButton = 0 To lNumberOfButtons - 1
CommandButton(lCButton).Left = (lButtonMid * (lCButton + 1)) - (CommandButton(lCButton).Width / 2)
CommandButton(lCButton).Visible = True
Next
CommandButton(lDefButton).SetFocus
End Sub
Sub Form_Unload (Cancel As Integer)
ClipCursorClear 0&
End Sub